<?php

namespace App\Repositories;

use App\Models\BusinessModel;
use InfyOm\Generator\Common\BaseRepository;

/**
 * Class BusinessRepository
 * @package App\Repositories
 */
class BusinessRepository extends BaseRepository
{
    /**
     * @var array
     */
    protected $fieldSearchable = [
        
    ];

    /**
     * Configure the Model
     **/
    public function model()
    {
        return BusinessModel::class;
    }

    /**
     *
     * @param $searchOptions
     * @param $sortOptions
     * @return mixed
     */
    public function search($searchOptions, $sortOptions)
    {
        $qb = (new BusinessModel)->getQueryBySearchOptions($searchOptions);

        $count = $qb->count();

        $lists = BusinessModel::setPage($qb, $sortOptions);

        $lists['total'] = $count;

        return $lists;
    }
}
